<template>
  <div class="content">
    <CloudForm :data="forms" v-model="value" ref='cloud' :labelWidth="135" />
  </div>
</template>
<script type="text/javascript">
import formData from './form';
export default {
  props: {
    value: [Array, Object]
  },
  data() {
    return {

  
    };
  },
  /**
   * 计算属性
   * @type {Object}
   */
  computed: {
    forms() {
      let data = {};
      let keys = Object.keys(this.value);
      for (let index in keys) {
        let item = keys[index];
        if (formData[item]) {
          data[item] = formData[item];
        }
      }
      return data
    }
  },
  /**
   * 数据监听
   * @type {Object}
   */
  watch: {

  },
  /**
   * 页面加载执行
   * @return {[type]} [description]
   */
  async mounted() {

  },
  /**
   * 页面方法
   * @type {Object}
   */
  methods: {
    affirm(e) {
      let { handleCancel } = e;
      this.$refs.cloud.submit().then(data => {
        this.$cloud.project().apply(data, 'config.options.' + data.AppID).then(res => {
          console.log('提交返回值', res);
          handleCancel();
        }).catch(error => {
          console.log('错误', error);
        });
      }).catch(error => {
        console.log('error', error);
      });
    }
  }
};

</script>
<style type="text/css" scoped="true">
</style>
